import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from './views/login/Login.vue';
import handleRouter from './handleRouter';

Vue.use(VueRouter);


const routers = [{
        path: '/',
        redirect: {
            name: 'login'
        }
    },
    {
        path: '/admin-login',
        name: 'admin-login',
        component: () => import('./views/login/admin-login.vue')
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            title: '登陆',
        },
        component: Login
    },
    {
        path: '/api/:name',
        name: 'api-detail',
        component: () => import('./views/home/Api-detail/views.vue')
    },

    {
        path: '/home',
        name: 'home',
        component: () => import('./views/home/index.vue'),
        children: [{
                path: '/',
                component: () => import('./views/home/home-content.vue')
            },
            {
                path: 'payGateWay',
                name: 'payGateWay',
                component: () => import('./views/payGateWay/views.vue')
            },
            {
                path: 'api-book',
                name: 'api-book',
                component: () => import('./views/home/Api-book/views.vue')
            },
            {
                path: 'api-key',
                name: 'api-key',
                component: () => import('./views/home/APP-management/views.vue')
            },
            {
                path: 'recharge-center',
                name: 'recharge-center',
                component: () => import('./views/home/Recharge-center/views.vue')
            },

            {
                path: 'detect',
                name: 'detect',
                component: () => import('./views/home/Face-recognition/detect/views.vue')
            },
            {
                path: 'agegender',
                name: 'agegender',
                component: () => import('./views/home/Face-recognition/age-gender/views.vue')
            },
            {
                path: 'detecthead',
                name: 'detecthead',
                component: () => import('./views/home/Face-recognition/detect-head/views.vue')
            },
            {
                path: 'emotion',
                name: 'emotion',
                component: () => import('./views/home/Face-recognition/emotion/views.vue')
            },
            {
                path: 'faceaging',
                name: 'faceaging',
                component: () => import('./views/home/Face-recognition/face-aging/views.vue')
            },
            {
                path: 'facecompare',
                name: 'facecompare',
                component: () => import('./views/home/Face-recognition/face-compare/views.vue')
            },
            {
                path: 'generate_3d_model',
                name: 'generate_3d_model',
                component: () => import('./views/home/Face-recognition/generate-3d-model/views.vue')
            },
            {
                path: 'haircolor',
                name: 'haircolor',
                component: () => import('./views/home/Face-recognition/hair-color/views.vue')
            },
            {
                path: 'hairsegement',
                name: 'hairsegement',
                component: () => import('./views/home/Face-recognition/hair-segement/views.vue')
            },
            {
                path: 'landmarks',
                name: 'landmarks',
                component: () => import('./views/home/Face-recognition/landmarks/views.vue')
            },
            {
                path: 'makeupswap',
                name: 'makeupswap',
                component: () => import('./views/home/Face-recognition/makeupswap/views.vue')
            },
            {
                path: 'swapface',
                name: 'swapface',
                component: () => import('./views/home/Face-recognition/swapface/views.vue')
            },
            {
                path: 'texture-swap-3d',
                name: 'texture-swap-3d',
                component: () => import('./views/home/Face-recognition/texture-swap-3d/views.vue')
            },
            {
                path: 'beautyrank',
                name: 'beautyrank',
                component: () => import('./views/home/Face-recognition/beautyrank/views.vue')
            },
            {
                path: 'skinclassify',
                name: 'skinclassify',
                component: () => import('./views/home/Face-recognition/skin-classify/views.vue')
            }

        ]

    },
    {
        path: '/panx-home',
        name: 'panx-home',
        component: () => import('./views/panx-home/index.vue'),
        children: [{
                path: '/',
                component: () => import('./views/panx-home/home-content.vue')
            },
            {
                path: 'panx-api-key',
                name: 'panx-api-key',
                component: () => import('./views/panx-home/APP-management/views.vue')
            },
            {
                path: 'panx-overview',
                name: 'panx-overview',
                component: () => import('./views/panx-home/overview/overview.vue')
            },
            {
                path: 'panx-financial-center',
                name: 'panx-financial-center',
                component: () => import('./views/panx-home/Financial-center/views.vue')
            },
            {
                path: 'panx-billing-plan',
                name: 'panx-billing-plan',
                component: () => import('./views/panx-home/Billing-plan/views.vue')
            },
            {
                path: 'panx-financial-detail',
                name: 'panx-financial-detail',
                component: () => import('./views/panx-home/Financial-detail/views.vue')
            },

        ]
    }
]

// 路由配置
const RouterConfig = {
    // mode: 'history',
    mode: 'hash',
    routes: routers,
};

const router = new VueRouter(RouterConfig);

router.beforeEach(handleRouter.before);
router.afterEach(handleRouter.after);

export default router;
